bitkeeper revision 1.1159.212.74 (42015ef3sPQp8pjeJAck1wBtTAYL9g)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 2 Feb 2005 23:14:59 +0000 (23:14 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 2 Feb 2005 23:14:59 +0000 (23:14 +0000)
Interface to typed allocator is now just xmalloc/xmalloc_array/xfree.
_xmalloc/_xmalloc_array are dead (or, at least, non-API).
Signed-off-by: keir.fraser@cl.cam.ac.uk
xen/arch/x86/microcode.c
xen/arch/x86/pci-pc.c
xen/arch/x86/shadow.c
xen/include/asm-x86/shadow.h
xen/include/xen/slab.h

index d2c87fd6f659d790d1da56187fa0c2864f2417e4..aa2966688e968e660d714314c62193fe776681d0 100644 (file)
@@ -84,7 +84,7 @@
 #define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
 #define down(_m) spin_lock(_m)
 #define up(_m) spin_unlock(_m)
-#define vmalloc(_s) _xmalloc(_s)
+#define vmalloc(_s) ((void *)xmalloc(u8[_s]))
 #define vfree(_p) xfree(_p)
 #define num_online_cpus() smp_num_cpus
 static inline int on_each_cpu(
index 68f3832bb6c1a3b4c193be9934fcd4cc9ed47063..09f562655b9c88e805a6ece49822c8df047684d8 100644 (file)
@@ -1036,7 +1036,7 @@ struct irq_routing_table * __devinit pcibios_get_irq_routing_table(void)
        if (ret & 0xff00)
                printk(KERN_ERR "PCI: Error %02x when fetching IRQ routing table.\n", (ret >> 8) & 0xff);
        else if (opt.size) {
-               rt = _xmalloc(sizeof(struct irq_routing_table) + opt.size);
+               rt = (struct irq_routing_table *)xmalloc(u8[sizeof(struct irq_routing_table) + opt.size]);
                if (rt) {
                        memset(rt, 0, sizeof(struct irq_routing_table));
                        rt->size = opt.size + sizeof(struct irq_routing_table);
index 8d5a201cb81077219326c0c2155bd99605b1e0ec..c2fcd00779081692de3a392241f1fa8a4ff88328 100644 (file)
@@ -185,7 +185,8 @@ int shadow_mode_enable(struct domain *p, unsigned int mode)
     {
         m->shadow_dirty_bitmap_size = (p->max_pages + 63) & ~63;
         m->shadow_dirty_bitmap = 
-            _xmalloc(m->shadow_dirty_bitmap_size/8);
+            xmalloc_array(unsigned long, m->shadow_dirty_bitmap_size /
+                                         (8 * sizeof(unsigned long)));
         if ( m->shadow_dirty_bitmap == NULL )
         {
             m->shadow_dirty_bitmap_size = 0;
index 9a45f1173718783b3a695b62670d9126787df953..fa518baff7c7a31841d7f613266c3ff8c5c6e1ce 100644 (file)
@@ -616,8 +616,8 @@ static inline void set_shadow_status(
     {
         SH_LOG("Allocate more shadow hashtable blocks.");
 
-        extra = _xmalloc(
-            sizeof(void *) + (shadow_ht_extra_size * sizeof(*x)));
+        extra = (struct shadow_status *)xmalloc(
+            u8[sizeof(void *) + (shadow_ht_extra_size * sizeof(*x))]);
 
         /* XXX Should be more graceful here. */
         if ( extra == NULL )
index 25406617dcbb2eb0d6f4420ced1846919a68200d..68d0ba00fb5971f2d5767210fb220bcdc7ee9266 100644 (file)
@@ -54,16 +54,10 @@ extern int xmem_cache_reap(void);
 extern void dump_slabinfo();
 
 /* Nicely typesafe for you. */
-#define xmalloc(type) ((type *)_xmalloc(sizeof(type)))
-#define xmalloc_array(type, num) ((type *)_xmalloc_array(sizeof(type), (num)))
-
-static inline void *_xmalloc_array(size_t size, size_t num)
-{
-       /* Check for overflow. */
-       if (size && num > UINT_MAX / size)
-               return NULL;
-       return _xmalloc(size * num);
-}
+#define xmalloc(_type) ((typeof(_type) *)_xmalloc(sizeof(_type)))
+#define xmalloc_array(_type, _num)                 \
+((_type *)(((_num) > (UINT_MAX / sizeof(_type))) ? \
+           NULL : _xmalloc((_num) * sizeof(_type))))
 #endif /* __ARCH_HAS_SLAB_ALLOCATOR */
 
 #endif /* __SLAB_H__ */